package com.aisile.admin.controller;

import com.aisile.admin.AdChannelControllerApi;
import com.aisile.admin.service.imol.AdChannelServiceImpl;
import com.aisile.model.admin.dtos.ChannelDto;
import com.aisile.model.admin.pojos.AdChannel;
import com.aisile.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController //controller层
@CrossOrigin //跨域
@RequestMapping("/api/v1/adcannel") //接口地址
public class AdChannelController implements AdChannelControllerApi {

    @Autowired
    private AdChannelServiceImpl adChannelService;

    /**
     * 分页条件查询
     * @param dto
     * @return
     */
    @PostMapping("list")
    @Override
    public ResponseResult findByPage(@RequestBody ChannelDto dto) {
        return adChannelService.findByPage(dto);
    }

    /**
     * 添加
     * @param adChannel
     * @return
     */
    @PostMapping("/save")
    @Override
    public ResponseResult saveAdchannel(@RequestBody AdChannel adChannel) {
        return adChannelService.saveAdchannel(adChannel);
    }

    /**
     * 修改
     * @param adChannel
     * @return
     */
    @PutMapping("/upadta")
    @Override
    public ResponseResult updateAdchannel(@RequestBody AdChannel adChannel) {
        return adChannelService.updateAdchannel(adChannel);
    }


    /**
     * 批量删除
     * @param ids
     * @return
     */
    @PostMapping("/dels")
    @Override
    public ResponseResult delsAdchannel(@RequestBody List<Integer> ids) {
        return adChannelService.delsAdchannel(ids);
    }
}
